home *** CD-ROM | disk | FTP | other *** search
/ Arcade Mania (Corel) / Corel Arcade Mania.iso / pc / standard / setup.mst < prev    next >
Encoding:
Text File  |  1995-08-15  |  38.7 KB  |  1,092 lines

  1. '************************************************************
  2. '$INCLUDE 'setupapi.inc'
  3. '$INCLUDE 'mscpydis.inc'
  4. '$INCLUDE 'msdetect.inc'
  5.  
  6. '$DEFINE DEBUG          ''Define for script development/debugging
  7.  
  8. ''Dialog ID's
  9. CONST WELCOME           = 100
  10. CONST ASKQUIT           = 200
  11. CONST DESTPATH          = 300
  12. CONST EXITFAILURE       = 400
  13. CONST EXITQUIT          = 600
  14. CONST EXITSUCCESS       = 700
  15. CONST OPTIONS           = 800
  16. CONST APPHELP           = 900
  17. CONST APPHELP2          = 1500
  18. CONST APPHELP3          = 1700
  19. CONST CHECK             = 2500
  20. CONST TOOBIG            = 6300
  21. CONST BADPATH           = 6400
  22. CONST REGANDREAD        = 6500
  23. CONST DESTGRP           = 6600
  24.  
  25. CONST VERPATH                  = 1100
  26. CONST EXITFAILNOTWIN31         = 1200
  27. CONST EXITFAILNOTENH           = 1300
  28. CONST EXITFAILNOTPAGING        = 1325
  29. CONST EXITFAILNOTINTEL         = 1350
  30. CONST EXITFAILRUNAPP           = 1360
  31.  
  32. CONST RESTARTII     = 2700
  33. CONST FINALEXIT     = 1000
  34.  
  35. CONST WINGWELCOME       = 100
  36. CONST WINGASKQUIT       = 200
  37. CONST WINGDESTPATH      = 300
  38. CONST WINGDESTPATH2     = 301
  39. CONST WINGEXITFAILURE   = 400
  40. CONST WINGEXITQUIT      = 600
  41. CONST WINGEXITSUCCESS   = 700
  42. CONST WINGAPPHELP       = 900
  43. CONST WINGCHECK         = 2500
  44. CONST WINGBADPATH       = 6400
  45. CONST RESTART           = 1000
  46.  
  47. ''Bitmap ID
  48. CONST LOGO              = 1
  49. CONST WINGLOGO          = 1
  50.  
  51. ''Disk Sizes
  52. 'GLOBAL File1
  53. 'GLOBAL File2
  54. GLOBAL WantedDiskSize&
  55.  
  56. ''File Types
  57. GLOBAL DEST$
  58. GLOBAL WINDRIVE$
  59. GLOBAL OPTCUR$
  60. GLOBAL CHECKSTATES$
  61. GLOBAL RUNTIME$
  62. GLOBAL AVITOOLS$
  63. GLOBAL MDKTOOLS$
  64. GLOBAL TOOLS$
  65. CONST WING_RUNFILES     = 1
  66. CONST WING_BUILDFILES   = 2
  67.  
  68.  
  69. GLOBAL FILEDIALOG
  70. GLOBAL WINGDEST$
  71. GLOBAL WINGCHECKSTATES$
  72. GLOBAL TMPDEST$
  73. GLOBAL bInstallDVA%
  74.  
  75. SrcDir$ = GetSymbolValue("STF_SRCDIR")
  76. WinDir$ = GetWindowsDir()
  77. WinSysDir$ = GetWindowsSysDir()
  78.  
  79. GLOBAL DESTWIN$      ''Windows directory.
  80. GLOBAL DESTSYS$      ''Windows\System directory.
  81. GLOBAL DEST32S$      ''Windows\System\Win32s directory
  82. GLOBAL DESTFREE$     ''Freecell directory
  83. GLOBAL OLE_PROTECT%  ''Indicates whether ole2 dlls were protected from being
  84.                      '' copied.
  85. GLOBAL OLE_OLEBOOT%
  86. GLOBAL VERNUM$       '' Win32s Version Number (i.e., for v1.25 VERNUM$="125"
  87.  
  88. DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
  89. DECLARE SUB RecoverFromCopy(szFileName$)
  90. DECLARE SUB WriteLine LIB "INIUPD.DLL" (filename$, text$)
  91. DECLARE FUNCTION GetTempFileName LIB "KRNL386.EXE" (drive%, prefix$, u%, filename$) AS INTEGER
  92. DECLARE FUNCTION GetTempFileAt(szDir$, szPrefix$) as string
  93. DECLARE FUNCTION LoadLibrary LIB "KRNL386.EXE" (arg1$) AS INTEGER
  94. DECLARE SUB FreeLibrary LIB "KRNL386.EXE" (arg1%)
  95. DECLARE FUNCTION SetErrorMode LIB "KRNL386.EXE" (arg1%) AS INTEGER
  96. DECLARE SUB UpdateSystemIni
  97. DECLARE FUNCTION ShareEnabled LIB "INIUPD.DLL" AS INTEGER
  98. DECLARE FUNCTION PagingEnabled LIB "INIUPD.DLL" AS INTEGER
  99. DECLARE FUNCTION IsWin32sLoaded LIB "INIUPD.DLL" (arg1$) AS INTEGER
  100. DECLARE FUNCTION GetModuleHandle LIB "KRNL386.EXE" (arg1$) AS INTEGER
  101. DECLARE FUNCTION IsRunningApp LIB "INIUPD.DLL" AS INTEGER
  102. DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
  103. DECLARE FUNCTION ExitWindowsExec LIB "user.exe" (Exec$, Param$) AS INTEGER
  104. DECLARE FUNCTION WinGMakePath (szDir$, szFile$) AS STRING
  105. DECLARE FUNCTION GetRealWindowsSysDir AS STRING
  106. DECLARE SUB Install(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%)
  107. DECLARE SUB UpdateWinG32 (szOrig$) 
  108. DECLARE FUNCTION OnWin3x LIB "setuphlp.DLL" AS INTEGER
  109. DECLARE FUNCTION VflatdPresent LIB "setuphlp.DLL" AS INTEGER
  110. DECLARE FUNCTION GetRealSystemDir LIB "setuphlp.DLL" (szDir$,cbBuf%) AS INTEGER
  111. DECLARE FUNCTION RestartWindows LIB "setuphlp.DLL" AS INTEGER
  112. DECLARE FUNCTION IsWin32FileNewer LIB "setuphlp.DLL" (szOrig$,szNew$) AS INTEGER
  113. DECLARE SUB RenameFilePlease LIB "setuphlp.DLL" (szOrig$,szNew$) 
  114. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  115. '************************************************************
  116.  
  117. '************************************************************
  118. ' Product Specific Variables
  119.  
  120. GLOBAL MAIN_WINDOW_TITLE$
  121. GLOBAL DESTINATION_GROUP$
  122. GLOBAL PRODUCT_TITLE$
  123. GLOBAL PRODUCTE_EXEC_NAME$
  124. GLOBAL README_FILE_NAME$
  125. GLOBAL CD_HOME_STRING$
  126. GLOBAL PRODUCT_HARD_DRIVE_REQUIREMENT&
  127. '************************************************************
  128.  
  129. '************************************************************
  130. ' START
  131. '************************************************************
  132. WINGINIT:
  133.  
  134.     '************************************************************
  135.     'Program specific changes. Hopefully all will be moved into here.
  136.  
  137.     ' Win32s Setup Test
  138. '    MAIN_WINDOW_TITLE$              = "Win32s Setup Test + Lunar Fox"                   ' Title you wish to appear at the top of all the setup windows
  139. '    DESTINATION_GROUP$              = "Corel CD Home"                                   ' Windows group you wish to create or add this product to, also start directory on hard drive
  140. '    PRODUCT_TITLE$                  = "Win32S Setup Test"                               ' Product title as it should appear on the icon, readme, etc.
  141. '    PRODUCT_EXEC_NAME$              = "lunarfox"                                        ' Product executable filename, used for icon, sub directory, etc.
  142. '    README_FILE_NAME$               = "\readme.cwb"                                     ' Readme filename and file type for this product
  143. '    CD_HOME_STRING$                 = "cdhome"                                          ' Group name and ini file name.
  144. '    PRODUCT_HARD_DRIVE_REQUIREMENT &= 4000000                                           ' Space need on hard drive for all product install files.
  145.  
  146.     ' Wild Board
  147. '    MAIN_WINDOW_TITLE$              = "Corel Wild Board Games Installation"             ' Title you wish to appear at the top of all the setup windows
  148. '    DESTINATION_GROUP$              = "Corel CD Home"                                   ' Windows group you wish to create or add this product to, also start directory on hard drive
  149. '    PRODUCT_TITLE$                  = "Wild Board Games"                                ' Product title as it should appear on the icon, readme, etc.
  150. '    PRODUCT_EXEC_NAME$              = "wildgame"                                        ' Product executable filename, used for icon, sub directory, etc.
  151. '    README_FILE_NAME$               = "\readme.cwb"                                     ' Readme filename and file type for this product
  152. '    CD_HOME_STRING$                 = "cdhome"                                          ' Group name and ini file name.
  153. '    PRODUCT_HARD_DRIVE_REQUIREMENT &= 16000000                                          ' Space need on hard drive for all product install files.
  154.  
  155.     ' Corel Arcade Mania
  156.     MAIN_WINDOW_TITLE$              = "Corel Arcade Mania Installation"                 ' Title you wish to appear at the top of all the setup windows
  157.     DESTINATION_GROUP$              = "Corel CD Home"                                   ' Windows group you wish to create or add this product to, also start directory on hard drive
  158.     PRODUCT_TITLE$                  = "Arcade Mania"                                    ' Product title as it should appear on the icon, readme, etc.
  159.     PRODUCT_EXEC_NAME$              = "cam1"                                            ' Product executable filename, used for icon, sub directory, etc.
  160.     README_FILE_NAME$               = "\readme.am1"                                     ' Readme filename and file type for this product
  161.     CD_HOME_STRING$                 = "cdhome"                                          ' Group name and ini file name.
  162.     PRODUCT_HARD_DRIVE_REQUIREMENT &= 10000000                                          ' Space need on hard drive for all product install files.
  163.     '************************************************************
  164.  
  165.     bInstallDVA% = 0
  166.     
  167.     WINGCUIDLL$ = "wingcui.dll"            ''Custom wing interface dll
  168.     WINGHELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  169.  
  170.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  171.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  172.  
  173.     WIN32ENABLED% = 0
  174.     OLEONLY% = 0
  175.     OLE2_16% = 0
  176.     OLE2AUTO_16% = 0
  177.     OLE16RUNAPP% = 0
  178.     OLE_PROTECT% = 0
  179.     OLE_OLEBOOT% = 0
  180.     ON ERROR GOTO ERRNORMAL
  181.  
  182.     DESTWIN$ = GetWindowsDir()
  183.     DESTSYS$ = GetWindowsSysDir()
  184.     DEST32S$ = DESTSYS + "WIN32S\"
  185.  
  186.     SetBitmap WINGCUIDLL$, WINGLOGO
  187.     SetTitle MAIN_WINDOW_TITLE$
  188.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  189.  
  190.     IF szInf$ = "" THEN
  191.         szInf$ = GetSymbolValue("STF_CWDDIR") + "setup.inf"
  192.     END IF
  193.  
  194.     ReadInfFile szInf$
  195.  
  196. WINGWELCOME:
  197. WINGCHECK:
  198. WELCOME:
  199.         SetRestartDir GetWindowsDir()
  200.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  201.     WINGDEST$ = GetWindowsSysDir
  202.     
  203.     ' ========
  204.     ' Adding test for space needed for WinG
  205.     ClearCopyList
  206.     WantedDiskSize&=400000
  207.  
  208.     WINDRIVE$ = MID$(WinDir$, 1, 1)
  209.     DiskSize&=GetFreeSpaceForDrive(WINDRIVE$)
  210.  
  211.     If WantedDiskSize& > DiskSize& then
  212.         GOTO WING_SPACE_ERROR
  213.     EndIf
  214.     ' ========
  215.  
  216.     AddSectionFilesToCopyList "runtime", SrcDir$, WINGDEST$
  217.     IF OnWin3x() = 1 THEN
  218.         AddSectionFilesToCopyList "dva", SrcDir$, WINGDEST$
  219.         IF VflatdPresent() = 0 THEN
  220.             CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
  221.             bInstallDVA% = 1
  222.         END IF
  223.     END IF
  224.  
  225. GETPATH:
  226.     WINDRIVE$ = MID$(WinDir$, 1, 1)
  227.     cdromdrive$ = MID$(SrcDir$, 1, 3)
  228.     DEST$ = WINDRIVE$ + ":\"+CD_HOME_STRING$+"\" + PRODUCT_EXEC_NAME$
  229.     SetSymbolValue "EditTextIn", DEST$
  230.     SetSymbolValue "EditFocus", "END"
  231.  
  232. GETPATHL1:
  233.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  234.     DEST$ = GetSymbolValue("EditTextOut")
  235.  
  236.     IF sz$ = "CONTINUE" THEN
  237.         IF IsDirWritable(DEST$) = 0 THEN
  238.             GOSUB BADPATH
  239.             GOTO GETPATHL1
  240.         END IF
  241.         UIPop 1
  242.     ELSEIF sz$ = "REACTIVATE" THEN
  243.         GOTO GETPATHL1
  244.     ELSEIF sz$ = "BACK" THEN
  245.         UIPop 1
  246.         GOTO WELCOME
  247.     ELSE
  248.         GOSUB ASKQUIT
  249.         GOTO GETPATH
  250.     END IF
  251.     
  252.     WINGDEST$ = GetRealWindowsSysDir
  253.  
  254.     AddSectionFilesToCopyList "wing32", SrcDir$, WINGDEST$
  255.     Dest1$ = WinGMakePath(WINGDEST$,"wing32.dll")
  256.     Dest2$ = WinGMakePath(WINGDEST$,"wing32.xxx")
  257.     RenameFilePlease Dest1$,Dest2$
  258.  
  259.     CopyFilesInCopyList
  260.  
  261.     UpdateWinG32 GetRealWindowsSysDir()
  262.  
  263.  
  264. WINGQUIT:
  265.     ON ERROR GOTO WINGERRQUIT
  266.  
  267.     IF ERR = 0 THEN
  268.         dlg% = WINGEXITSUCCESS
  269.     ELSEIF ERR = STFQUIT THEN
  270.         dlg% = WINGEXITQUIT
  271.     ELSE
  272.         dlg% = WINGEXITFAILURE
  273.     END IF
  274.  
  275. WINGQUITL1:
  276.     GOTO INIT
  277.     sz$ = UIStartDlg(WINGCUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  278.     IF sz$ = "REACTIVATE" THEN
  279.         GOTO WINGQUITL1
  280.     END IF
  281.     UIPop 1
  282.     
  283.     END
  284.  
  285. WINGERRQUIT:
  286.     i% = DoMsgBox(PRODUCT_TITLE$+" was not installed correctly!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  287.     END
  288.  
  289.  
  290.  
  291. WINGASKQUIT:
  292.     sz$ = UIStartDlg(WINGCUIDLL$, WINGASKQUIT, "FQuitDlgProc", 0, "")
  293.  
  294.     IF sz$ = "EXIT" THEN
  295.         UIPopAll
  296.         ERROR STFQUIT
  297.     ELSEIF sz$ = "REACTIVATE" THEN
  298.         GOTO WINGASKQUIT
  299.     ELSE
  300.         UIPop 1
  301.     END IF
  302.     RETURN
  303.  
  304.  
  305. '************************************************************
  306. ERRQUIT:
  307.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  308.     END
  309. '************************************************************
  310.  
  311. '************************************************************
  312. ASKQUIT:
  313.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  314.  
  315.     IF sz$ = "EXIT" THEN
  316.         UIPopAll
  317. ''        ERROR STFQUIT
  318.     END
  319.     ELSEIF sz$ = "REACTIVATE" THEN
  320.         GOTO ASKQUIT
  321.     ELSE
  322.         UIPop 1
  323.     END IF
  324.     RETURN
  325. '************************************************************
  326.  
  327. '************************************************************
  328. TOOBIG:
  329.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  330.     IF sz$ = "REACTIVATE" THEN
  331.         GOTO TOOBIG
  332.     END IF
  333.     UIPop 1
  334.     RETURN
  335. '************************************************************
  336.  
  337. '************************************************************
  338. BADPATH:
  339.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  340.     IF sz$ = "REACTIVATE" THEN
  341.         GOTO BADPATH
  342.     END IF
  343.     UIPop 1
  344.     RETURN
  345. '************************************************************
  346.  
  347. '************************************************************
  348. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  349.     IF szDir$ = "" THEN
  350.         MakePath = szFile$
  351.     ELSEIF szFile$ = "" THEN
  352.         MakePath = szDir$
  353.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  354.         MakePath = szDir$ + szFile$
  355.     ELSE
  356.         MakePath = szDir$ + "\" + szFile$
  357.     END IF
  358. END FUNCTION
  359. '************************************************************
  360.  
  361. '************************************************************
  362. '' Bypass run-time errors. Let final dialog box display fatal error message.
  363. ERRNORMAL:
  364.     '' Check if user cancelled setup
  365.     IF ERR = STFQUIT THEN
  366.         GOTO QUIT
  367.     END IF
  368.     RESUME NEXT
  369. '************************************************************
  370.  
  371. '*************************************************************************
  372. SUB Install(OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%) STATIC
  373.  
  374.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  375.  
  376.     '' Use file layout sections that specify OLDER file version/time check
  377.     IF OLEONLY% = 0 THEN
  378.         AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$
  379.         AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  380.         '' Add obsolete files to be removed
  381.         AddSectionFilesToCopyList "Win32sSystemObsoleteFiles", SrcDir$, DESTSYS$ + "WIN32S\"
  382.     END IF
  383.  
  384.     OLE_PROTECT% = 0
  385.     OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  386.     if OLEINCLUDED% = 1 THEN
  387.         IF (OLE2_16% = 1) OR (OLE2AUTO_16% = 1) THEN
  388.             IF OLE16RUNAPP% = 1 THEN
  389.                 '' Force all OLE2 DLLS to be copied during reboot.
  390.                 i% = SetErrorMode(-32768)
  391.                 i% = LoadLibrary(DESTSYS$ + "compobj.dll")
  392.                 i% = LoadLibrary(DESTSYS$ + "ole2.dll")
  393.                 i% = LoadLibrary(DESTSYS$ + "ole2prox.dll")
  394.                 i% = LoadLibrary(DESTSYS$ + "ole2conv.dll")
  395.                 i% = LoadLibrary(DESTSYS$ + "storage.dll")
  396.                 i% = LoadLibrary(DESTSYS$ + "ole2nls.dll")
  397.                 i% = LoadLibrary(DESTSYS$ + "ole2disp.dll")
  398.                 i% = LoadLibrary(DESTSYS$ + "typelib.dll")
  399.                 OLE_PROTECT% = 1
  400.             END IF
  401.             AddSectionFilesToCopyList "OleWindowsSystem", SrcDir$, DESTSYS$
  402.         END IF
  403.         IF OLE2_32% = 1 THEN
  404.             AddSectionFilesToCopyList "OleWindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
  405.         END IF
  406.         IF (OLE2_16% = 1) OR (OLE2_32% = 1) OR (OLE2AUTO_16% = 1) THEN
  407.             AddSectionFilesToCopyList "Ole2RegWindowsSystem", SrcDir$, DESTSYS$
  408.         END IF
  409.         IF (OLE2AUTO_16% = 1) THEN
  410.             AddSectionFilesToCopyList "StdoleWindowsSystem", SrcDir$, DESTSYS$
  411.             IF (OLE16RUNAPP and DoesFileExist(DESTSYS$ + "stdole.tlb", femExists) ) THEN
  412.                 ' copy stdole.tlb -> tempfile1
  413.                 stdole1$ = DESTSYS$ + GetTempFileAt(DESTSYS$, "STD")
  414.                 CopyFile DESTSYS$+"STDOLE.TLB", stdole1$, cmoOverwrit, 0
  415.                 OLE_OLEBOOT% = 1
  416.             ENDIF
  417.         END IF
  418.     END IF
  419.  
  420. '   mmh - alan - fix for bug found (Tue  07-18-1995), leave this line in, do NOT comment it out
  421.  
  422.     CopyFilesInCopyList
  423.  
  424.     IF (OLEINCLUDED% = 1) THEN
  425.         RecoverFromCopy DESTSYS$ + "compobj.dll"
  426.         RecoverFromCopy DESTSYS$ + "ole2.dll"
  427.         RecoverFromCopy DESTSYS$ + "ole2prox.dll"
  428.         RecoverFromCopy DESTSYS$ + "ole2conv.dll"
  429.         RecoverFromCopy DESTSYS$ + "storage.dll"
  430.         RecoverFromCopy DESTSYS$ + "ole2nls.dll"
  431.         RecoverFromCopy DESTSYS$ + "ole2disp.dll"
  432.         RecoverFromCopy DESTSYS$ + "typelib.dll"
  433.     END IF
  434.  
  435.     IF (OLE_PROTECT% = 1) THEN
  436.         '' Free all previously loaded libraries
  437.         FreeLibrary GetModuleHandle("compobj")
  438.         FreeLibrary GetModuleHandle("ole2")
  439.         FreeLibrary GetModuleHandle("ole2prox")
  440.         FreeLibrary GetModuleHandle("ole2conv")
  441.         FreeLibrary GetModuleHandle("storage")
  442.         FreeLibrary GetModuleHandle("ole2nls")
  443.         FreeLibrary GetModuleHandle("ole2disp")
  444.         FreeLibrary GetModuleHandle("typelib")
  445.         OLE_PROTECT% = 0
  446.     END IF
  447.     IF (OLE_OLEBOOT% = 1) THEN
  448.         'rename new stdole.tlb -> tempfile2
  449.         stdole2$ = GetTempFileAt(DESTSYS$, "STD")
  450.         RemoveFile DESTSYS$+stdole2$, cmoForce
  451.         RenameFile DESTSYS$+"STDOLE.TLB" , stdole2$
  452.         'rename tempfile1 -> stdole.tlb
  453.         RenameFile stdole1$, "STDOLE.TLB"
  454.         'write to _mssetup.bat: rename tempfile2 to stdole.tlb
  455.         WriteLine DESTWIN$+"_MSSETUP.BAT", ""
  456.         WriteLine DESTWIN$+"_MSSETUP.BAT", "DEL "+DESTSYS$+"STDOLE.TLB"
  457.         WriteLine DESTWIN$+"_MSSETUP.BAT", "REN "+DESTSYS$+stdole2$+" STDOLE.TLB"
  458.     ENDIF
  459.     IF OLEINCLUDED% AND (OLE2_16% OR OLE2_32% OR OLE2AUTO_16%) THEN
  460.         IF OLE16RUNAPP% THEN
  461.             reg1$ = DESTWIN$ + GetTempFileAt(DESTWIN$, "REG")
  462.             CopyFile DESTWIN$+"REG.DAT", reg1$, cmoOverwrit, 0
  463.         ENDIF
  464.  
  465.         RUN "regedit /s " + DESTSYS$ + "ole2.reg"
  466.  
  467.         IF OLE16RUNAPP% THEN
  468.             reg2$ = GetTempFileAt(DESTWIN$, "REG")
  469.             RemoveFile DESTWIN$ + reg2$, cmoForce
  470.             RenameFile DESTWIN$ + "REG.DAT" , reg2$
  471.             'rename tempfile1 -> reg.dat
  472.             RenameFile reg1$, "REG.DAT"
  473.             'write to _mssetup.bat: rename tempfile2 to reg.dat
  474.             WriteLine DESTWIN$+"_MSSETUP.BAT", ""
  475.             WriteLine DESTWIN$+"_MSSETUP.BAT", "DEL "+DESTWIN$+"REG.DAT"
  476.             WriteLine DESTWIN$+"_MSSETUP.BAT", "REN "+DESTWIN$ + reg2$+" REG.DAT"
  477.             OLE_OLEBOOT% = 1
  478.         ENDIF
  479.     END IF
  480. END SUB
  481.  
  482. SUB UpdateSystemIni STATIC
  483.  
  484.     VxDPath$ = DEST32S$ + "W32S.386"
  485.     SystemIniPath$ = GetWindowsDir()
  486.  
  487.     t% = MakeSystemIni(SystemIniPath$, VxdPath$)
  488.  
  489. END SUB
  490. '*************************************************************************
  491.  
  492. '*************************************************************************
  493. SUB RecoverFromCopy(szFileName$) STATIC
  494.     IF DoesFileExist(szFileName$, femExist) = 0 THEN
  495.         szBackFile$ = MID$(szFileName$, 1, LEN(szFileName$)-3) + VERNUM$
  496.         IF DoesfileExist(szBackFile$, femExist) = 0 THEN
  497.             i% = DoMsgBox("ERROR: Could not find backup file "+szBackfile$, "Setup Error", MB_ICONEXLAMATION + MB_OK)
  498.         ELSE
  499.             CopyFile szBackFile$, szFileName$, cmoTimeStamp, 0
  500.         END IF
  501.     END IF
  502. END SUB
  503. '*************************************************************************
  504.  
  505. '*************************************************************************
  506. FUNCTION GetTempFileAt(szDir$, szPrefix$) STATIC AS STRING
  507.     szCurDir$ = CURDIR$
  508.     CHDIR szDir$ + "."
  509.     szTempFile$ = STRING$(144, "E")
  510.     i% = GetTempFileName(TF_FORCEDRIVE, szPrefix$,0, szTempFile$)
  511.     CHDIR szCurDir$
  512.     GetTempFileAt = MID$(szTempFile$,3)
  513. END FUNCTION
  514. '*************************************************************************
  515.  
  516. '*************************************************************************
  517. MIKE_TEST1:
  518.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  519.     UIPop 1
  520.     RETURN
  521. '*************************************************************************
  522.  
  523. '*************************************************************************
  524. MIKE_TEST2:
  525.     sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
  526.     UIPop 1
  527.     RETURN
  528. '*************************************************************************
  529.  
  530. '************************************************************ 
  531. FUNCTION WinGMakePath (szDir$, szFile$) STATIC AS STRING
  532.     IF szDir$ = "" THEN
  533.         WinGMakePath = szFile$
  534.     ELSEIF szFile$ = "" THEN
  535.         WinGMakePath = szDir$
  536.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  537.         WinGMakePath = szDir$ + szFile$
  538.     ELSE
  539.         WinGMakePath = szDir$ + "\" + szFile$
  540.     END IF
  541. END FUNCTION
  542. '************************************************************
  543.  
  544. '************************************************************
  545. FUNCTION GetRealWindowsSysDir STATIC AS STRING
  546.     szBuf$ = string$(260, 32)
  547.     cbBuf% = GetRealSystemDir(szBuf$, 260)
  548.     IF cbBuf% = 0 THEN
  549.         ERROR STFERR
  550.     ELSE
  551.         IF cbBuf% > 259 THEN
  552.             res% = DoMsgBox("Buffer Overflow", "MS-Setup Error", MB_ICONHAND+MB_OK)
  553.             ERROR STFERR
  554.         END IF
  555.  
  556.         szBuf$ = RTRIM$(szBuf$)
  557.  
  558.         IF MID$(szBuf$, 1, 1) = "\" THEN
  559.             szBuf$ = MID$(CURDIR$, 1, 2) + szBuf$
  560.         ELSEIF MID$(szBuf$, 2, 1) <> ":" THEN
  561.             szBuf$ = MID$(CURDIR$, 1, 3) + szBuf$
  562.         END IF
  563.  
  564.         IF MID$(szBuf$, LEN(szBuf$), 1) <> "\" THEN
  565.             szBuf$ = szBuf$ + "\"
  566.         END IF
  567.         GetRealWindowsSysDir = szBuf$
  568.     END IF
  569.  
  570.     szBuf$ = ""
  571. END FUNCTION
  572. '************************************************************
  573.  
  574. '************************************************************
  575. SUB UpdateWinG32 (szOrig$) STATIC
  576.     '
  577.     ' Here we check the version ourselves of wing32.dll, since 
  578.     ' we can't get version checking for Win32 apps from Win16
  579.     '
  580.     FileNew$ = WinGMakePath(szOrig$, "wing32.dll")
  581.     FileOrig$ = WinGMakePath(szOrig$, "wing32.xxx")
  582.     IF IsWin32FileNewer( FileOrig$, FileNew$ ) THEN
  583.         RemoveFile FileOrig$, cmoForce
  584.     ELSE
  585.         RemoveFile FileNew$, cmoForce           ' get rid of new file
  586.         RenameFilePlease FileOrig$,FileNew$     ' put back old file
  587.     END IF
  588. END SUB
  589. '************************************************************
  590.  
  591. '************************************************************
  592. INIT:
  593.     ClearCopyList
  594.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  595.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  596.  
  597.     MajorVer% = GetWindowsMajorVersion()
  598.     MinorVer% = GetWindowsMinorVersion()
  599.  
  600.     IF  MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN
  601.         i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software.  Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  602.     END
  603.     END IF
  604.  
  605.     SetBitmap CUIDLL$, LOGO
  606.     SetTitle MAIN_WINDOW_TITLE$
  607.  
  608.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  609.     IF szInf$ = "" THEN
  610.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  611.     END IF
  612.     ReadInfFile szInf$
  613.  
  614. ClearCopyList
  615.     WantedDiskSize&=1689000
  616.  
  617.     DiskSize&=GetFreeSpaceForDrive(WINDRIVE$)
  618.  
  619.     If WantedDiskSize& > DiskSize& then
  620.         GOSUB TOOBIG
  621.         ERROR STFQUIT
  622.     EndIf
  623.  
  624.  
  625. '' Setting Video for Windows RUNTIME files to be copied
  626.  
  627.     AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
  628.     AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
  629.     AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
  630.     AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
  631.     AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$
  632.     AddSectionFilesToCopyList "Indeo-ini", SrcDir$, WinDir$
  633.  
  634. CopyFilesInCopyList
  635.  
  636. ''Updating WIN.INI and SYSTEM.INI
  637.     IF VflatdPresent() = 0 THEN
  638.        CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite
  639.     END IF
  640.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
  641.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
  642.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "indeov.drv", cmoOverwrite
  643.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
  644.     I% = DoesIniKeyExist ("system.ini", "Drivers", "VIDC.RT21")
  645.     IF I% = 0  THEN
  646.        CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "indeov.drv", cmoOverwrite
  647.     END IF
  648.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "indeov.drv", cmoOverwrite
  649.     CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
  650.     CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
  651.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
  652.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
  653.     CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
  654.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
  655.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
  656.     CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
  657.     Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
  658.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
  659.     Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
  660.  
  661.     ' ***********************************
  662.     ' Add Win32s files and code here.
  663.     ' {
  664.     ' MIKE
  665.  
  666.     '' Check that we are not runnig on Chicago, including pre-released
  667.     '' Chicago versions.
  668.     IF GetWindowsMajorVersion * 100 + GetWindowsMinorVersion > 350 THEN
  669.         ExitCode% = EXITSUCCESS
  670.         WIN32ENABLED% = 1
  671.         GOTO WIN32S_QUIT
  672.     END IF
  673.  
  674.     IF GetWindowsMode < 2  THEN
  675.         IF OnWindowsNT() THEN
  676.             ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
  677.         ELSE
  678.             ExitCode% = EXITFAILNOTENH   '' Standard Mode Windows
  679.         END IF
  680.         GOTO WIN32S_QUIT
  681.     END IF
  682.  
  683.     IF OnWindowsNT() THEN
  684.         ExitCode% = EXITSUCCESS
  685.         WIN32ENABLED% = 1
  686.         GOTO WIN32S_QUIT
  687.     END IF
  688.  
  689.     ExitCode% = EXITSUCCESS
  690.  
  691.     if IsRunningApp() <> 0 THEN
  692.         ExitCode% = EXITFAILRUNAPP
  693.         GOTO WIN32S_QUIT
  694.     END IF
  695.  
  696.     '' Get version of Win32s to be installed from version info in INF file
  697.     szNewVer$ = GetSectionKeyVersion("WindowsSystem", "win32s16")
  698.  
  699.     '' See if OLE is included.
  700.  
  701.     OLEINCLUDED% = DoesFileExist( GetSymbolValue("STF_SRCDIR") + "OLE2THK.DL_", femExists )
  702.  
  703.     IF OLEINCLUDED% = 1 THEN
  704.         '' See whether one of the OLE 16 bit components is loaded.
  705.         IF GetModulehandle("compobj") <> 0 THEN
  706.             OLE16RUNAPP% = 1
  707.             GOTO GetOleVersion
  708.         END IF
  709.         IF GetModuleHandle("ole2") <> 0 THEN
  710.             OLE16RUNAPP% = 1
  711.             GOTO GetOleVersion
  712.         END IF
  713.         IF GetModuleHandle("ole2prox") <> 0 THEN
  714.             OLE16RUNAPP% = 1
  715.             GOTO GetOleVersion
  716.         END IF
  717.         IF GetModuleHandle("ole2conv") <> 0 THEN
  718.             OLE16RUNAPP% = 1
  719.             GOTO GetOleVersion
  720.         END IF
  721.         IF GetModuleHandle("storage") <> 0 THEN
  722.             OLE16RUNAPP% = 1
  723.             GOTO GetOleVersion
  724.         END IF
  725.         IF GetModuleHandle("ole2nls") <> 0 THEN
  726.             OLE16RUNAPP% = 1
  727.             GOTO GetOleVersion
  728.         END IF
  729.         IF GetModuleHandle("ole2disp") <> 0 THEN
  730.             OLE16RUNAPP% = 1
  731.             GOTO GetOleVersion
  732.         END IF
  733.         IF GetModuleHandle("typelib") <> 0 THEN
  734.             OLE16RUNAPP% = 1
  735.             GOTO GetOleVersion
  736.         END IF
  737.  
  738.  
  739. GetOleVersion:
  740.         szOleNewVer$ = GetSectionKeyVersion("OleWindowsSystemWin32s", "ole2thk")
  741.  
  742.         '' Get version of currently installed OLE32 from version info of
  743.         '' ole2thk file
  744.         szOleOldVer$ = GetVersionOfFile( DESTSYS$ + "WIN32S\OLE2THK.DLL" )
  745.  
  746.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "COMPOBJ.DLL" )
  747.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "compobj")
  748.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  749.             OLE2_16% = 1
  750.         END IF
  751.  
  752.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2.DLL" )
  753.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2")
  754.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  755.             OLE2_16% = 1
  756.         END IF
  757.  
  758.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2PROX.DLL" )
  759.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2prox")
  760.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  761.             OLE2_16% = 1
  762.         END IF
  763.  
  764.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "STORAGE.DLL" )
  765.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "storage")
  766.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  767.             OLE2_16% = 1
  768.         END IF
  769.  
  770.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2CONV.DLL" )
  771.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2conv")
  772.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  773.             OLE2_16% = 1
  774.         END IF
  775.  
  776.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2NLS.DLL" )
  777.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2nls")
  778.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  779.             OLE2AUTO_16% = 1
  780.         END IF
  781.  
  782.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "OLE2DISP.DLL" )
  783.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "ole2disp")
  784.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  785.             OLE2AUTO_16% = 1
  786.         END IF
  787.  
  788.         szOle16OldVer$ = GetVersionOfFile( DESTSYS$ + "TYPELIB.DLL" )
  789.         szOle16NewVer$ = GetSectionKeyVersion("OleWindowsSystem", "typelib")
  790.         IF (szOle16NewVer$ > szOle16OldVer$) THEN
  791.             OLE2AUTO_16% = 1
  792.         END IF
  793.  
  794.     END IF
  795.  
  796.     OLE2_32% = OLEINCLUDED%
  797.  
  798.     '' Check if Win32s is partially installed
  799.     sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "Win32s", "Setup")
  800.  
  801.     '' If WIN32S.INI specifies Win32s Setup=0, then force complete Win32s file overwrite
  802.     IF sz$ = "0" THEN
  803.         GOTO WIN32S_WELCOME
  804.     END IF
  805.  
  806.     '' If WIN32S.INI is missing, try and reinstall Win32s files/recreate WIN32S.INI
  807.     IF sz$ <> "1" THEN
  808.         GOTO WIN32S_WELCOME
  809.     END IF
  810.  
  811.     '' If Win32s is already installed, get running version number
  812.     i% = DoesFileExist( DESTSYS$ + "W32SYS.DLL", femExists )
  813.     IF i% = 1 THEN
  814.         i% = IsWin32sLoaded( szOldVer$ )
  815.     ENDIF
  816.  
  817.     IF i% = 0 THEN
  818.         GOTO WIN32S_WELCOME
  819.     END IF
  820.  
  821.     IF szNewVer$ > szOldVer$ THEN
  822.         GOTO WIN32S_WELCOME
  823.     END IF
  824.  
  825.     IF OLEINCLUDED% = 1 THEN
  826.  
  827.         OLE2_32% = 0
  828.  
  829.         IF (szNewVer$ = szOldVer$) OR (szNewVer$ < szOldVer$) THEN
  830.             '' Compare OLE32 version and versions of each of OLE16 libraries.
  831.             sz$ = GetIniKeyString (DESTSYS$ + "WIN32S.INI", "OLE", "Setup")
  832.             '' If WIN32S.INI specifies OLE2 Setup=0, then force OLE2 file overwrite
  833.             IF ((sz$ <> "1") OR (szOleNewVer$ > szOleOldVer$)) THEN
  834.                 OLEONLY% = 1
  835.                 OLE2_32% = 1
  836.                 GOTO WIN32S_WELCOME
  837.             END IF
  838.  
  839.             IF OLE2_16% OR OLE2AUTO_16 THEN
  840.                 OLEONLY% = 1
  841.                 GOTO WIN32S_WELCOME
  842.             END IF
  843.  
  844.         END IF
  845.  
  846.     END IF
  847.  
  848.     WIN32ENABLED% = 1
  849.     GOTO WIN32S_QUIT
  850.  
  851. WIN32S_WELCOME:
  852. GETWIN32SPATH:
  853.     IF PagingEnabled() = 0 THEN
  854.         i% = DoMsgBox("Use the Control Panel 386 Enhanced icon and configure Windows using the Virtual Memory option.", "Win32s requires Virtual Memory", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  855.         ExitCode% = EXITFAILURE '' Enhanced mode but not paging
  856.         GOTO WIN32S_QUIT
  857.     END IF
  858.  
  859.     IF ShareEnabled() = 0 THEN
  860.         i% = DoMsgBox( "File-sharing must be enabled. Run SHARE.EXE before starting Windows or add SHARE.EXE to your AUTOEXEC.BAT file.", "Win32s Setup: SHARE.EXE is not loaded", MB_TASKMODAL+MB_ICONEXCLAMATION+MB_OK)
  861.     END IF
  862.  
  863.     SetSymbolValue "EditTextIn", DESTSYS$
  864.     SetSymbolValue "EditFocus", "END"
  865.  
  866. WIN32S_GETPATHL1:
  867.     DESTSYS$ = GetWindowsSysDir
  868.  
  869. COPYFILES:
  870.     IF OLEONLY% = 0 THEN
  871.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  872.     END IF
  873.  
  874.     IF OLE2_32% = 1 THEN
  875.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Setup", "0", cmoOverwrite
  876.     END IF
  877.  
  878.     '' Indicate Win32s install failure until all files known to be copied.
  879.     ExitCode% = EXITFAILURE
  880.     ERR = 0
  881.  
  882.     CreateDir DEST32S$, cmoNone
  883.  
  884.     Install OLEONLY%, OLE2_32%, OLE2_16%, OLE2AUTO_16%, OLE16RUNAPP%
  885.     UpdateSystemIni
  886.  
  887.     '' Terminate if unhandled fatal error
  888.     IF ERR <> 0 THEN
  889.         GOTO WIN32S_QUIT
  890.     END IF
  891.  
  892.     IF OLEONLY% = 0 THEN
  893.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite
  894.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite
  895.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Nls", "AnsiCP", "1252", cmoOverwrite
  896.     END IF
  897.  
  898.     IF OLE2_32% = 1 THEN
  899.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Setup", "1", cmoOverwrite
  900.         CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Version", szOleNewVer, cmoOverwrite
  901.     END IF
  902.  
  903. WIN32S_QUIT:
  904.     '' Install error handler for final message box routines
  905.     ON ERROR GOTO ERRQUIT
  906.     IF ERR = 0 THEN
  907.         dlg% = ExitCode%
  908.     ELSEIF ERR = STFQUIT THEN
  909.         IF (OLE_PROTECT% = 1) THEN
  910.             '' Free all previously loaded libraries
  911.             FreeLibrary GetModuleHandle("compobj")
  912.             FreeLibrary GetModuleHandle("ole2")
  913.             FreeLibrary GetModuleHandle("ole2prox")
  914.             FreeLibrary GetModuleHandle("ole2conv")
  915.             FreeLibrary GetModuleHandle("storage")
  916.             FreeLibrary GetModuleHandle("ole2nls")
  917.             FreeLibrary GetModuleHandle("ole2disp")
  918.             FreeLibrary GetModuleHandle("typelib")
  919.         END IF
  920.         dlg% = EXITQUIT
  921.         ExitCode% = EXITQUIT
  922.     ELSE
  923.         dlg% = EXITFAILURE
  924.         ExitCode% = EXITQUIT
  925.     END IF
  926.  
  927. WIN32S_QUITL1:
  928. '    IF WIN32ENABLED% = 1 THEN
  929. '        UIPop 1
  930. '        END
  931. '    END IF
  932.  
  933. '    sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  934. '    IF sz$ = "REACTIVATE" THEN
  935. '        GOTO WIN32S_QUITL1
  936. '    END IF
  937.     UIPop 1
  938.  
  939. '    IF ExitCode% = EXITSUCCESS THEN
  940. '        IF RebootSystem(OLEONLY% and not OLE_OLEBOOT%) = 0 THEN
  941. '            CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
  942. '            IF OLE2_32% = 1 THEN
  943. '                CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "OLE", "Setup", "0", cmoOverwrite
  944. '            END IF
  945. '            i% = DoMsgBox("Win32s is not properly configured and Win32s Setup must be run again.", "Unable to Restart Windows", MB_ICONEXCLAMATION+MB_OK+MB_TASKMODAL)
  946. '        END IF
  947. '    ENDIF
  948.  
  949. '    END
  950.     ' End of Win32s Install portion
  951.     ' }
  952.     ' ***********************************
  953.  
  954. DO_PROGRAM_FILES:
  955.     CreateDir DEST$, cmoNone
  956.     DESTDRIVE$ = MID$(DEST$, 1, 1)
  957.  
  958. ClearCopyList
  959.     AddSectionFilesToCopyList "product_files", SrcDir$, DEST$
  960.  
  961. ' Set to hard drive space neede for program
  962.     WantedDiskSize&=PRODUCT_HARD_DRIVE_REQUIREMENT&
  963.  
  964.     DiskSize&=GetFreeSpaceForDrive(DESTDRIVE$)
  965.  
  966.     If WantedDiskSize& > DiskSize& then
  967.         GOSUB TOOBIG
  968.         ERROR STFQUIT
  969.     EndIf
  970.  
  971. CopyFilesInCopyList
  972.  
  973. ' Autorun feature, Win95
  974. CreateIniKeyValue WinDir$ + CD_HOME_STRING$+".ini", PRODUCT_EXEC_NAME$, "dir", DEST$, cmoOverwrite
  975.  
  976. ' Run video for Windows Profiler
  977.     Run ("profdisp.exe")   
  978.  
  979. ' Set up program group and icon
  980. GETGROUP:
  981.     DESTGROUP$ = DESTINATION_GROUP$
  982.     SetSymbolValue "EditTextIn", DESTGROUP$
  983.     SetSymbolValue "EditFocus", "END"
  984.  
  985. GETGROUPL1:
  986.     sz$ = UIStartDlg(CUIDLL$, DESTGRP, "FEditDlgProc", 0, "")
  987.     DESTGROUP$ = GetSymbolValue("EditTextOut")
  988.  
  989.     IF sz$ = "CONTINUE" THEN
  990.         IF DESTGROUP = "" OR DESTGROUP = " " OR DESTGROUP = "  " OR DESTGROUP = "   " THEN
  991.             GOTO GETGROUPL1
  992.         END IF
  993.  
  994.         UIPop 1
  995.     ELSEIF sz$ = "REACTIVATE" THEN
  996.         GOTO GETGROUPL1
  997.     ELSE
  998.         GOSUB ASKQUIT
  999.         GOTO GETGROUP
  1000.     END IF
  1001.  
  1002.     CreateProgmanGroup DESTGROUP$, "", cmoNone
  1003.     ShowProgmanGroup  DESTGROUP$, 1, cmoNone
  1004.     CreateProgmanItem DESTGROUP$, PRODUCT_TITLE$, DEST$+"\"+PRODUCT_EXEC_NAME$+".exe" , "", cmoOverwrite
  1005.     CreateProgmanItem DESTGROUP$, PRODUCT_TITLE$+" Read Me", "notepad.exe "+DEST$+README_FILE_NAME$ , "", cmoOverwrite
  1006. '************************************************************
  1007.  
  1008. '************************************************************
  1009. QUIT:
  1010.     ON ERROR GOTO ERRQUIT
  1011.  
  1012.     IF ERR = 0 THEN
  1013.         dlg% = EXITSUCCESS
  1014.     ELSEIF ERR = STFQUIT THEN
  1015.         dlg% = EXITQUIT
  1016.     ELSE
  1017.         dlg% = EXITFAILURE
  1018.     END IF
  1019.  
  1020. QUITL1:
  1021.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  1022.     IF sz$ = "REACTIVATE" THEN
  1023.         GOTO QUITL1
  1024.     END IF
  1025.  
  1026.     UIPop 1
  1027.  
  1028.    sz$ = UIStartDlg(CUIDLL$, REGANDREAD, "FInfoDlgProc", 0, "")
  1029.    UIPop 1
  1030.    IF sz$ = "CONTINUE" THEN
  1031.        Run("notepad.exe "+DEST$+README_FILE_NAME$)
  1032.    ENDIF
  1033. '************************************************************
  1034.  
  1035. '************************************************************
  1036. RESTARTWINDOWS:
  1037. '    DEST$ = GetSymbolValue("EditTextOut")
  1038. '    GOSUB MIKE_TEST1
  1039. '    With this commented out it seems to work but do I really want to do this
  1040. '    SetRestartDir DEST$
  1041. '    SetRestartDir GetWindowsDir()
  1042.     RESTRT% = RestartListEmpty ()
  1043.     Exe$ = GetWindowsDir() + "\_msrstrt.exe"
  1044.     Batch$ = GetWindowsDir() + "\_mssetup.bat"
  1045. '    Exe$ = DEST$ + "\_msrstrt.exe"
  1046. '    Batch$ = DEST$ + "\_mssetup.bat"
  1047.     empty$ = ""
  1048.  
  1049. RESTART:
  1050.     IF RESTRT% = 0 THEN
  1051.        sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
  1052.        IF sz$ = "REACTIVATE" THEN
  1053.            GOTO RESTART
  1054.        ENDIF
  1055.        I% = ExitExecRestart ()
  1056.        RemoveFile Exe$, cmoForce
  1057.        RemoveFile Batch$, cmoForce
  1058.        END
  1059.     ELSE
  1060.        sz$ = UIStartDlg(CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "")
  1061.        IF sz$ = "CONTINUE" THEN
  1062.            I% = ExitWindowsExec (Exe$, empty$)
  1063.            IF I% = 0 THEN
  1064.                GOTO RESTART
  1065.            ELSE
  1066.                END
  1067.            ENDIF
  1068.        ELSEIF sz$ = "EXIT" THEN
  1069.                UIPop 1
  1070.                sz$ = UIStartDlg(CUIDLL$, FINALEXIT, "FInfo0DlgProc", 0, "")
  1071.                UIPopAll
  1072.                END
  1073.            ELSEIF sz$ = "REACTIVATE" THEN
  1074.                    GOTO RESTART
  1075.                ELSE
  1076.                    UIPop 1
  1077.                END IF
  1078.            END IF
  1079.    END
  1080. '************************************************************
  1081.  
  1082. '************************************************************
  1083. WING_SPACE_ERROR:
  1084.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  1085.     IF sz$ = "REACTIVATE" THEN
  1086.     GOTO WING_SPACE_ERROR
  1087.     END IF
  1088.     UIPop 1
  1089.     i% = DoMsgBox("Setup sources were corrupted!", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  1090.     END
  1091. '************************************************************
  1092.